import {defineStore} from 'pinia'
import {ref} from 'vue'
import {cacheKeys} from '@/stores/constant/cacheKey'

export const useAuthorityStore = defineStore(cacheKeys.AUTHORITY, () => {

	// 正在分配权限的角色
	const editingRole = ref<SysRole>()

	function resetAuthorityStore() {
		editingRole.value = undefined
	}

	return {
		editingRole: editingRole,
		resetAuthorityStore: resetAuthorityStore
	}
}, {
	persist: {
		key: cacheKeys.AUTHORITY,
		storage: window.sessionStorage
	}
})
